package com.example.myapplication.KeChengFragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapplication.KeChengMingShiFragment.KeChengMingShiQiangfenChongCiFragment;
import com.example.myapplication.KeChengMingShiAdapter.MingShiNanDianAdapter;
import com.example.myapplication.KeChengMingShiAdapter.MingShiXiTongFuXIAdapter;
import com.example.myapplication.KeChengMingShiBean.MingShiRvNanDianBean;
import com.example.myapplication.KeChengMingShiBean.MingShiRvXiTongBean;
import com.example.myapplication.R;

import java.util.ArrayList;
import java.util.List;

public class MingShiKeChengFragment extends Fragment {
    RecyclerView MingShi_RV1,MingShi_RV2,MingShi_RV3;
    List<MingShiRvXiTongBean> listXiTongFuXi=new ArrayList<>();
    List<MingShiRvNanDianBean> listNanDian=new ArrayList<>();
    FragmentManager fragmentManager;
    FragmentTransaction fragmentTransaction;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.kecheng_fragment_mingshikecheng,container,false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        XiTongFuXi(view);
        NanDianTuPo(view);
        QiangFenChongCi(view);

    }

    private void QiangFenChongCi(View view) {
        fragmentManager=getActivity().getSupportFragmentManager();
        fragmentTransaction=fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.MingShi_fl,new KeChengMingShiQiangfenChongCiFragment());
        fragmentTransaction.commit();

    }

    private void NanDianTuPo(View view) {
        MingShi_RV2=view.findViewById(R.id.MingShi_RV_NanDianTuPo);
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电磁弹射相关人员训练","电磁弹射相关人员训练","付费","伟大的人"));
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电子通信相关人员训练","电子通信相关人员训练","付费","伟大的人"));
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电子技术基础相关人员训练","电子技术基础相关人员训练","付费","伟大的人"));
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电子技术实验相关人员训练","电子技术实验相关人员训练","付费","伟大的人"));
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电子工程制图(电子CAD)相关人员训练","电子工程制图(电子CAD)相关人员训练","付费","伟大的人"));
        listNanDian.add(new MingShiRvNanDianBean(R.mipmap.dianzixinxi,"5年","电子测量仪器相关人员训练","电子测量仪器相关人员训练","付费","伟大的人"));
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this.getActivity());
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        MingShi_RV2.setLayoutManager(linearLayoutManager);

        MingShiNanDianAdapter mingShiNanDianAdapter=new MingShiNanDianAdapter(listNanDian);
        MingShi_RV2.setAdapter(mingShiNanDianAdapter);
    }

    private void XiTongFuXi(View view) {
        MingShi_RV1=view.findViewById(R.id.MingShi_RV_XiTongFuXi);
        listXiTongFuXi.add(new MingShiRvXiTongBean(R.mipmap.lunjupeixu,"5年","陆军相关人员训练","陆军相关技术人员训练","付费","伟大的人"));
        listXiTongFuXi.add(new MingShiRvXiTongBean(R.mipmap.haijunpeixun,"5年","海军相关人员训练","海军相关技术人员训练","付费","伟大的人"));
        listXiTongFuXi.add(new MingShiRvXiTongBean(R.mipmap.kongjunpeixun,"5年","空军相关人员训练","空军相关技术人员训练","付费","伟大的人"));
        listXiTongFuXi.add(new MingShiRvXiTongBean(R.mipmap.zhidaojishu,"5年","导弹相关人员训练","导弹相关技术人员训练","付费","伟大的人"));
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this.getActivity());
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        MingShi_RV1.setLayoutManager(linearLayoutManager);
        MingShiXiTongFuXIAdapter mingShiXiTongFuXIAdapter=new MingShiXiTongFuXIAdapter(listXiTongFuXi);
        MingShi_RV1.setAdapter(mingShiXiTongFuXIAdapter);

    }
}